package com.ykg.util;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ykg.enums.ResultEnum;
import lombok.Data;

/**
 * TODO
 * 类(接口)：
 * Created on 8:26 2021/6/23.
 *
 * @Author: laobian
 * @Description:
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultResponse {
    /* 错误码*/
    private Integer code;
    /* 信息*/
    private String msg;
    /* 数据*/
    private Object data;

    public ResultResponse() {
        this.code = ResultEnum.SUCCESS.getCode();
        this.msg = ResultEnum.SUCCESS.getMsg();
    }

    public ResultResponse(Object data) {
        this.code = ResultEnum.SUCCESS.getCode();
        this.msg = ResultEnum.SUCCESS.getMsg();
        this.data = data;
    }

    public ResultResponse(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMsg();
    }

    public ResultResponse(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}